
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<!-- 通用CSS -->
<head >
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>登录</title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/component/pear/css/pear.css">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/admin/css/other/login.css" />
</head>

<!-- 代 码 结 构 -->
<body background="<%=request.getContextPath()%>/admin/images/background.svg">
<form class="layui-form" action="javascript:void(0);">
    <div class="layui-form-item">
        <img class="logo" src="<%=request.getContextPath()%>/admin/images/logo.png" />
        <div class="title">招生后台登录</div>
        <div class="desc">
        </div>
    </div>
    <div class="layui-form-item">
        <input name="username" type="text" placeholder="账 户" value="" hover class="layui-input"  />
    </div>
    <div class="layui-form-item">
        <input name="password" type="password" placeholder="密 码 " value="" hover class="layui-input"  />
    </div>
    <div class="layui-form-item">
        <input placeholder="验证码 : " name="vercode" hover class="code layui-input layui-input-inline"  />
        <img src="<%=request.getContextPath()%>/system/captcha/generate" class="codeImage" id="captchaImage"/>
    </div>

    <div class="layui-form-item">
        <%--<input type="checkbox" name="" title="记住密码" lay-skin="primary" checked>--%>
    </div>
    <div class="layui-form-item">
        <button class="pear-btn pear-btn-success login" lay-submit lay-filter="login">
            登 入
        </button>
    </div>
</form>
<!-- 通用JS -->
<div>
    <script src="<%=request.getContextPath()%>/component/layui/layui.js"></script>
    <script src="<%=request.getContextPath()%>/component/pear/pear.js"></script>
    <script src="<%=request.getContextPath()%>/component/jquery.min.js"></script>
    <script src="<%=request.getContextPath()%>/component/myCommon.js" charset="utf-8"></script>
</div>
<script>
    layui.use(['form','jquery','layer'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        let layer = layui.layer;

        form.on('submit(login)', function(data){
            let loader = layer.load();
            $(".login").html("<i class='layui-icon layui-anim layui-anim-rotate layui-anim-loop layui-icon-loading' />");
            $.ajax({
                url:'<%=request.getContextPath()%>/system/login',
                data:data.field,
                type:"post",
                dataType:'json',
                success:function(result){
                    layer.close(loader);
                    if(result.code == 0){
                        layer.msg(result.msg,{icon:1,time:1000},function(){
                            location.href = "<%=request.getContextPath()%>/system/index";
                        })
                    }else{
                        layer.msg(result.msg,{icon:2,time:1000},function(){
                            document.getElementById("captchaImage").src="<%=request.getContextPath()%>/system/captcha/generate?"+Math.random();
                        });
                    }
                    $(".login").html("登 入")
                }
            });
            return false;
        });

        $("#captchaImage").click(function(){
            document.getElementById("captchaImage").src="<%=request.getContextPath()%>/system/captcha/generate?"+Math.random();
        })

    })
</script>
<!-- Session 过期处理 -->
<script>
    if(window!=top){ top.location.href = location.href; }
</script>

</body>
</html>
